package boardgamer.yavalath.common;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * @author garysoed
 */
public class YavalathException extends Exception {

  public enum ErrorCode {
    HAS_FORCED_MOVE, INVALID_MOVE
  }

  private final ErrorCode errorCode;

  public static YavalathException invalidMove() {
    return new YavalathException(ErrorCode.INVALID_MOVE);
  }

  public static YavalathException hasForcedMove() {
    return new YavalathException(ErrorCode.HAS_FORCED_MOVE);
  }

  private YavalathException(ErrorCode errorCode) {
    this.errorCode = checkNotNull(errorCode, "errorCode");
  }

  public ErrorCode getErrorCode() {
    return errorCode;
  }
}
